package com.kkang.ch1.aop;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * aspectj 入口main
 *
 * @author yongk_liu
 **/
public class Main {

    public static void main(String[] args) {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(AopConfig.class);
        //获取这个bean,这个bean已被切入点poinCut，会执行Aspectj切入方法
        DemoAnnotionService demoAnnotionService = context.getBean(DemoAnnotionService.class);
        demoAnnotionService.add();
        //获取这个bean，这个bean被规则入了Aspectj的建言中
        DemoMethodService demoMethodService = context.getBean(DemoMethodService.class);
        demoMethodService.add();
        context.close();
    }

}
